<template>
  <div class="q-pa-md">
    <div class="q-gutter-y-md column" style="max-width: 300px">
      <t-toggle v-model="dense" label="Dense QField" />

      <t-field outlined :dense="dense">
        <template v-slot:control>
          <div class="self-center full-width no-outline" tabindex="0">{{
            text
          }}</div>
        </template>
      </t-field>

      <t-field outlined label="Label" stack-label :dense="dense">
        <template v-slot:control>
          <div class="self-center full-width no-outline" tabindex="0">{{
            text
          }}</div>
        </template>
      </t-field>

      <t-field
        outlined
        square
        hint="With perfect square borders"
        :dense="dense"
      >
        <template v-slot:control>
          <div class="self-center full-width no-outline" tabindex="0">{{
            text
          }}</div>
        </template>
      </t-field>

      <t-field outlined :dense="dense">
        <template v-slot:prepend>
          <t-icon name="event" />
        </template>

        <template v-slot:control>
          <div class="self-center full-width no-outline" tabindex="0">{{
            text
          }}</div>
        </template>
      </t-field>

      <t-field outlined :dense="dense">
        <template v-slot:control>
          <div class="self-center full-width no-outline" tabindex="0">{{
            text
          }}</div>
        </template>

        <template v-slot:append>
          <t-avatar>
            <img src="https://cdn.quasar.dev/logo-v2/svg/logo.svg" />
          </t-avatar>
        </template>
      </t-field>

      <t-field
        outlined
        :model-value="text"
        bottom-slots
        label="Label"
        stack-label
        counter
        :dense="dense"
      >
        <template v-slot:prepend>
          <t-icon name="place" />
        </template>

        <template v-slot:control>
          <div class="self-center full-width no-outline" tabindex="0">{{
            text
          }}</div>
        </template>

        <template v-slot:append>
          <t-icon name="close" class="cursor-pointer" />
        </template>

        <template v-slot:hint> Field hint </template>
      </t-field>

      <t-field
        outlined
        :model-value="text"
        bottom-slots
        label="Label"
        stack-label
        counter
        maxlength="12"
        :dense="dense"
      >
        <template v-slot:before>
          <t-icon name="flight_takeoff" />
        </template>

        <template v-slot:control>
          <div class="self-center full-width no-outline" tabindex="0">{{
            text
          }}</div>
        </template>

        <template v-slot:append>
          <t-icon v-if="text !== ''" name="close" class="cursor-pointer" />
          <t-icon name="search" />
        </template>

        <template v-slot:hint> Field hint </template>
      </t-field>

      <t-field
        outlined
        :model-value="text"
        bottom-slots
        label="Label"
        stack-label
        counter
        maxlength="12"
        :dense="dense"
      >
        <template v-slot:before>
          <t-avatar>
            <img src="https://cdn.quasar.dev/img/avatar5.jpg" />
          </t-avatar>
        </template>

        <template v-slot:control>
          <div class="self-center full-width no-outline" tabindex="0">{{
            text
          }}</div>
        </template>

        <template v-slot:append>
          <t-icon v-if="text !== ''" name="close" class="cursor-pointer" />
          <t-icon name="schedule" />
        </template>

        <template v-slot:hint> Field hint </template>

        <template v-slot:after>
          <t-btn round dense flat icon="send" />
        </template>
      </t-field>

      <t-field
        outlined
        :model-value="text"
        bottom-slots
        label="Label"
        stack-label
        counter
        maxlength="12"
        :dense="dense"
      >
        <template v-slot:before>
          <t-icon name="event" />
        </template>

        <template v-slot:control>
          <div class="self-center full-width no-outline" tabindex="0">{{
            text
          }}</div>
        </template>

        <template v-slot:hint> Field hint </template>

        <template v-slot:append>
          <t-btn round dense flat icon="add" />
        </template>
      </t-field>

      <t-field outlined hint="Disable" :dense="dense" disable>
        <template v-slot:control>
          <div class="self-center full-width no-outline">{{ text }}</div>
        </template>
      </t-field>

      <t-field outlined hint="Readonly" :dense="dense" readonly>
        <template v-slot:control>
          <div class="self-center full-width no-outline">{{ text }}</div>
        </template>
      </t-field>

      <t-field
        outlined
        hint="Disable and readonly"
        :dense="dense"
        disable
        readonly
      >
        <template v-slot:control>
          <div class="self-center full-width no-outline">{{ text }}</div>
        </template>
      </t-field>
    </div>
  </div>
</template>

<script>
  import { ref } from 'vue';

  export default {
    setup() {
      return {
        text: ref('Field content'),
        dense: ref(false),
      };
    },
  };
</script>
